import time
from selenium.webdriver.common.by import By
from Unit_10.Base.Base import Base

class Page1(Base):
    # 定位器
    # 1 请登录定位元素
    login_loc = (By.XPATH,'/html/body/div[2]/div/div[1]/div/a[1]')
    # 2 账号
    username_loc = (By.ID,'userName')
    # 3 密码
    password_loc= (By.ID,'password')
    # 4 输入验证码 强等
    # 5 点击登录
    login_btn_loc = (By.ID,'save')
    # 6 点击确定
    login_sure_loc = (By.ID,'bindSub')

    # 封装元素
    # 1 点击请登录
    def login(self):
        self.click(self.login_loc)
    # 2 输入账号密码
    def denglu(self):
        self.send_keys(self.username_loc,'18238680385')
        self.send_keys(self.password_loc,'123456Aa')
    # 3 强等输入验证码 10s
    # 4 点击登录按钮
    def login_btn(self):
        self.click(self.login_btn_loc)
    # 5 点击确定
    def login_sure(self):
        self.click(self.login_sure_loc)

    # 业务逻辑
    def jiuxian_luoji1(self):
        self.open_url('https://www.jiuxian.com/')
        self.login()
        self.denglu()
        time.sleep(10)
        self.login_btn()
        self.login_sure()

